//
// Created by wze-zero on 2024/10/21.
//
#include <iostream>

using namespace std;

bool check(long num) {
    long n = num;
    if (n < 1) {
        return false;
    } else {
        while (n * n > num) {
            n = (n + num / n) / 2;
        }
        return n * n == num;
    }
}

int main() {
    long n, num, max = -1;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> num;
        if (!check(num)) {
            max < num ? max = num : max;
        }
    }
    cout << max << endl;
    return 0;
}